<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        .tab{
            width: 500px;
            height: 500px;
            border: 1px solid #000;
            margin: 0 auto;
            overflow: hidden;
        }
        .tab .tab-wrapper{
            height: 50px;
            border-bottom: 1px solid #000;
        }
        .tab .tab-item {
            float: left;
            width: 25%;
            height: 100%;
            text-align: center;
            line-height: 50px;
        }
        .tab .tab-item.active {
            background-color: #000;
            color: #fff;
        }
        .tab .page-wrapper {
            position: relative;
            height: 450px;
        }
        /* .fade 用于渐隐渐显 */
        .tab.fade .inner {
            position: relative;
            width: 100%;
            height: 100%;
        }
        .tab .page-item {
            width: 500px;
            height: 100%;
            text-align: center;
            font-size: 100px;
            line-height: 450px;
        }
        .tab.fade .page-item{
            position: absolute;
            top: 0;
            left: 0;
            display: none;
        }
        .tab.fade .page-item.active{
            display: block;
        }

        /* .slide 用于滚动 */
        .tab.slide .inner {
            position: absolute;
            left: 0;
            top: 0;
            width: 2000px; /*子元素的所有宽度之和*/
            height: 100%;
            transition: transform 0.3s;
        }

        .tab.slide .page-item {
            float: left;
            display: block;
            width: 500px;
            height: 100%;
        }


    </style>
</head>
<body>
    <div class="tab slide"> <!-- slide fade -->
        <div class="tab-wrapper">
            <div class="tab-item active">选项一</div>
            <div class="tab-item">选项二</div>
            <div class="tab-item">选项三</div>
            <div class="tab-item">选项四</div>
        </div>
        <div class="page-wrapper">
            <div class="inner"> <!-- inner 用来滚动 -->
                <div class="page-item active">页面一</div>
                <div class="page-item">页面二</div>
                <div class="page-item">页面三</div>
                <div class="page-item">页面四</div>
            </div>
        </div>
    </div>
    <script src="./src/index.ts" type="module"></script>
</body>
</html>